Laboratorio 1

Author

Patricio Porras

Published

September 27, 2025

Laboratorio 1

tipo_muerte zona subzona distrito circuito codigo_subcircuito subcircuito codigo_provincia provincia codigo_canton ... medida_edad sexo genero etnia estado_civil nacionalidad discapacidad profesion_registro_civil instruccion antecedentes
0 ASESINATO ZONA 1 ESMERALDAS ESMERALDAS LAS PALMAS 08D01C02S01 LAS PALMAS 1 8 ESMERALDAS 801 ... A MUJER FEMENINO AFRO SOLTERO ECUADOR NINGUNA QUEHACER. DOMESTICOS SIN_DATO SIN_DATO
1 ASESINATO ZONA 4 MANABÍ PORTOVIEJO SAN PABLO 13D01C05S02 SAN PABLO 2 13 MANABÍ 1301 ... A HOMBRE MASCULINO MESTIZO/A SOLTERO ECUADOR NINGUNA EMPLEADO PARTICULAR BASICA SIN_DATO
2 ASESINATO ZONA 4 MANABÍ PORTOVIEJO SAN PABLO 13D01C05S02 SAN PABLO 2 13 MANABÍ 1301 ... A HOMBRE MASCULINO MESTIZO/A SOLTERO ECUADOR NINGUNA ALBANIL SIN_DATO SIN_DATO
3 ASESINATO ZONA 4 MANABÍ MANTA LA PILA 13D02C14S01 LA PILA 1 13 MANABÍ 1309 ... A MUJER FEMENINO MESTIZO/A SOLTERO ECUADOR NINGUNA NINGUNA SIN_DATO SIN_DATO
4 ASESINATO ZONA 4 MANABÍ MANTA LA PILA 13D02C14S01 LA PILA 1 13 MANABÍ 1309 ... A MUJER FEMENINO MESTIZO/A SOLTERO ECUADOR NINGUNA QUEHACER. DOMESTICOS SECUNDARIA SIN_DATO

5 rows × 34 columns

codigo_provincia codigo_canton coordenada_x
count 4683.000000 4683.000000 4683.000000
mean 10.647662 1069.448430 -79.680911
std 4.313847 430.664369 1.391446
min 1.000000 101.000000 -80.972700
25% 9.000000 901.000000 -79.967170
50% 9.000000 906.000000 -79.886500
75% 12.000000 1211.000000 -79.560020
max 24.000000 2403.000000 0.000000
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4683 entries, 0 to 4682
Data columns (total 34 columns):
 #   Column                    Non-Null Count  Dtype  
---  ------                    --------------  -----  
 0   tipo_muerte               4683 non-null   object 
 1   zona                      4683 non-null   object 
 2   subzona                   4683 non-null   object 
 3   distrito                  4683 non-null   object 
 4   circuito                  4683 non-null   object 
 5   codigo_subcircuito        4683 non-null   object 
 6   subcircuito               4683 non-null   object 
 7   codigo_provincia          4683 non-null   int64  
 8   provincia                 4683 non-null   object 
 9   codigo_canton             4683 non-null   int64  
 10  canton                    4683 non-null   object 
 11  coordenada_y              4683 non-null   object 
 12  coordenada_x              4683 non-null   float64
 13  area_hecho                4683 non-null   object 
 14  lugar                     4683 non-null   object 
 15  tipo_lugar                4683 non-null   object 
 16  fecha_infraccion          4683 non-null   object 
 17  hora_infraccion           4683 non-null   object 
 18  arma                      4683 non-null   object 
 19  tipo_arma                 4683 non-null   object 
 20  presunta_motivacion       4683 non-null   object 
 21  presun_motiva_observada   4683 non-null   object 
 22  probable_causa_motivada   4683 non-null   object 
 23  edad                      4683 non-null   object 
 24  medida_edad               4683 non-null   object 
 25  sexo                      4683 non-null   object 
 26  genero                    4683 non-null   object 
 27  etnia                     4683 non-null   object 
 28  estado_civil              4683 non-null   object 
 29  nacionalidad              4683 non-null   object 
 30  discapacidad              4683 non-null   object 
 31  profesion_registro_civil  4683 non-null   object 
 32  instruccion               4683 non-null   object 
 33  antecedentes              4683 non-null   object 
dtypes: float64(1), int64(2), object(31)
memory usage: 1.2+ MB
C:\Users\Lenovo\AppData\Local\Temp\ipykernel_15084\3683265002.py:1: UserWarning: Parsing dates in %d/%m/%Y format when dayfirst=False (the default) was specified. Pass `dayfirst=True` or specify a format to silence this warning.
  data_df["fecha_infraccion_dt"] = pd.to_datetime(data_df["fecha_infraccion"], errors="coerce")
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4683 entries, 0 to 4682
Data columns (total 36 columns):
 #   Column                    Non-Null Count  Dtype         
---  ------                    --------------  -----         
 0   tipo_muerte               4683 non-null   object        
 1   zona                      4683 non-null   object        
 2   subzona                   4683 non-null   object        
 3   distrito                  4683 non-null   object        
 4   circuito                  4683 non-null   object        
 5   codigo_subcircuito        4683 non-null   object        
 6   subcircuito               4683 non-null   object        
 7   codigo_provincia          4683 non-null   int64         
 8   provincia                 4683 non-null   object        
 9   codigo_canton             4683 non-null   int64         
 10  canton                    4683 non-null   object        
 11  coordenada_y              4683 non-null   object        
 12  coordenada_x              4683 non-null   float64       
 13  area_hecho                4683 non-null   object        
 14  lugar                     4683 non-null   object        
 15  tipo_lugar                4683 non-null   object        
 16  fecha_infraccion          4683 non-null   object        
 17  hora_infraccion           4683 non-null   object        
 18  arma                      4683 non-null   object        
 19  tipo_arma                 4683 non-null   object        
 20  presunta_motivacion       4683 non-null   object        
 21  presun_motiva_observada   4683 non-null   object        
 22  probable_causa_motivada   4683 non-null   object        
 23  edad                      4683 non-null   float64       
 24  medida_edad               4683 non-null   object        
 25  sexo                      4683 non-null   object        
 26  genero                    4683 non-null   object        
 27  etnia                     4683 non-null   object        
 28  estado_civil              4683 non-null   object        
 29  nacionalidad              4683 non-null   object        
 30  discapacidad              4683 non-null   object        
 31  profesion_registro_civil  4683 non-null   object        
 32  instruccion               4683 non-null   object        
 33  antecedentes              4683 non-null   object        
 34  fecha_infraccion_dt       4683 non-null   datetime64[ns]
 35  year                      4683 non-null   int32         
dtypes: datetime64[ns](1), float64(2), int32(1), int64(2), object(30)
memory usage: 1.3+ MB

Graficar la edad de los homicidios y arma por provincia

Número de muertes por provincias